/**
 * 根据传入的表名查询数据库的数据
 * @param 表名
 * @returns Promise数据库数据
 */
import db from "../db/db.js";

const allDataSearch = async (tableName: string) => {
    return new Promise((resolve, reject) => {
        db.query(`SELECT * FROM ${tableName}`, (err, results) => {
            if (err) {
                return reject(err); 
            }
            resolve(results);
        });
    });
}

export default allDataSearch;